package com.hl.springboot4.filterintcepter;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

/**
 * @ClassName TestFilter
 * @Description TODO
 * @Author libowen
 * @Date 2025年03月06日 10:24
 * @Version 1.0
 */
//@WebFilter("/article/*")
public class TestFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        Filter.super.init(filterConfig);
    }
    @Override
    public void doFilter(ServletRequest servletRequest,
                         ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("我是过滤器，你要向通过，必须经过我！！！");
        // 过滤器默认不放行
        // 放行
        filterChain.doFilter(servletRequest, servletResponse);

        System.out.println("过滤器响应之后执行");
    }

    @Override
    public void destroy() {
        Filter.super.destroy();
    }
}
